FROM {{ namespace }}/{{ image_prefix }}openstack-base:{{ tag }}
{% block labels %}
LABEL maintainer="{{ maintainer }}" name="{{ image_name }}" build-date="{{ build_date }}"
{% endblock %}

{% block panko_base_header %}{% endblock %}

{% import "macros.j2" as macros with context %}

{{ macros.configure_user(name='panko') }}

{% if install_type == 'binary' %}
    {% if base_package_type == 'rpm' %}

        {% set panko_base_packages = [
            'openstack-panko-common',
        ] %}
    {% elif base_package_type == 'deb' %}
        {% set panko_base_packages = [
        ] %}
    {% endif %}

{{ macros.install_packages(panko_base_packages | customizable("packages")) }}
{% elif install_type == 'source' %}
    {% if base_package_type == 'rpm' %}

       {% set panko_base_packages = [
        ] %}
{{ macros.install_packages(panko_base_packages | customizable("packages")) }}
    {% elif base_package_type == 'deb' %}

       {% set panko_base_packages = [
        ] %}

{{ macros.install_packages(panko_base_packages | customizable("packages")) }}

   {% endif %}
ADD panko-base-archive /panko-base-source

{% set panko_base_pip_packages = [
    '/panko',
    'pymongo'
] %}

RUN ln -s panko-base-source/* panko \
    && {{ macros.install_pip(panko_base_pip_packages | customizable("pip_packages")) }} \
    && mkdir -p /etc/panko \
    && cp -r /panko/etc/panko/* /etc/panko/ \
    && chown -R panko: /etc/panko

{% endif %}

COPY extend_start.sh /usr/local/bin/kolla_extend_start

RUN touch /usr/local/bin/kolla_panko_extend_start \
    && chmod 755 /usr/local/bin/kolla_extend_start /usr/local/bin/kolla_panko_extend_start

{% block panko_base_footer %}{% endblock %}
